package day15.tarena.homework;
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
public class Register{
	public void register() {
		Scanner sca = new Scanner(System.in);
		List list = new ArrayList();
		out:while(true){
			Map map = new HashMap();
			while(true){
				System.out.println("Please enter your name");
				String name = sca.next();
				if("over".equalsIgnoreCase(name))break out;
				if(name.matches("^[A-Za-z0-9]{5,10}$")){
					map.put("name", name);
					break;
				}else{
					System.out.println("The name's  format is error!Please enter again");
				}	
			}
			while(true){
				System.out.println("Please enter your password!");
				String password = sca.next();
				if(password.matches("^[A-Za-z]+$")){
					map.put("password", password);
					break;
				}else{
					System.out.println("The password's formart is error! Please enter again!");
				}
			}
			while(true){
				System.out.println("Please enter your emali");
				String email = sca.next();
				if(email.matches("^[A-Za-z0-9]+[@][A-Za-z0-9]+(|\\.com|\\.cn|\\.net|\\.com.cn|\\.org)||$")){
					map.put("email", email);
					break;
				}else{
					System.out.println("The email's formart is wrong! Please enter again!");
				}
			}
		}
	
	}
	public static void main(String args[]){
		Register r1 = new Register();
			r1.register();
	}
}
